{% macro bot_dimensions(bot) %}
  {% if bot %}{{ render_dict(bot.dimensions) }}{% endif %}
{% endmacro %}

{% macro render_dict(data) %}
  {% for k, v in data.iteritems()|sort %}
    <strong>{{k}}</strong>:
    {% if v is string %}
      {{v}}
      <br>
    {% elif v is mapping %}
      <br>{{render_dict_idented(v, '&nbsp;&nbsp;')}}
    {% elif v is sequence %}
      {{v|sort|join(' | ')}}
      <br>
    {% else %}
      {{v}}
      <br>
    {% endif %}
  {% endfor %}
{% endmacro %}

{% macro render_dict_idented(data, indent) %}
  {% for k, v in data.iteritems()|sort %}
    {{indent|safe}}<strong>{{k}}</strong>:
    {% if v is string %}
      {{v}}<br>
    {% elif v is mapping %}
    <br>{{render_dict_idented(v, indent + '&nbsp;&nbsp;')}}
    {% elif v is sequence %}
      {{v|sort|join(' | ')}}<br>
    {% else %}
      {{v}}<br>
    {% endif %}
  {% endfor %}
{% endmacro %}

{% macro bot_link(bot_id, is_privileged_user) %}
  {% if bot_id %}
    {% if is_privileged_user %}
      <a href="/restricted/bot/{{bot_id}}">{{bot_id}}</a>
    {% else %}
      {{bot_id}}
    {% endif %}
  {% else %}
    &#8209;&#8209;
  {% endif %}
{% endmacro %}

{% macro pending_star(task) %}
  {% if task.is_pending %}*{% endif %}
{% endmacro %}

{% macro running_star(task) %}
  {% if task.is_running %}*{% endif %}
{% endmacro %}
